package com.forekenow.Demo11.exerce;

import java.util.*;

public class Practice2 {
    public static void main(String[] args) {
        String nba []= {"骑士","勇士","湖人","热火","老鹰","猛龙","篮网","凯尔","特人","小牛","活塞",
                "公牛","魔术","爵士","开拓","火箭"};
        List<String> list = new ArrayList<>();
        Set<Integer> set = new HashSet<>();
        for (String str : nba) {
            list.add(str);
        }
//        while (set.size() < 16){
//            set.add(((int) (Math.random() * 16))+(2<<16));
//        }
////        for (int i :
////                set) {
////            System.out.println(i - (2 << 16));
////        }
////        System.out.println("长度为："+set.size());
////        System.out.println("长度为："+list.size());
//        Iterator<Integer> iterator = set.iterator();
//        for (int i = 1,j = 1; i < list.size(); i+=4,j++) {
//            System.out.printf("第%d组：%s\t%s\t%s\t%S\n",
//                    j,list.get(iterator.next() - (2 << 16)),list.get(iterator.next() - (2 << 16)),list.get(iterator.next() - (2 << 16)),list.get(iterator.next() - (2 << 16)));
//        }
        Collections.shuffle(list);
        System.out.println(list.toString());
        for (int i = 0; i < list.size(); i+=4) {
            System.out.printf("第%d组：%s\t%s\t%s\t%s\n",i / 4 + 1,list.get(i),list.get(i+1),list.get(i+2),list.get(i+3));
        }
    }
}
